package com.mbc.hr.entities;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

@SuppressWarnings("serial")
@XmlRootElement
@Entity
@Table(name="HR_AttendanceLog")
@NamedQueries({
	@NamedQuery(name="AttendanceLog.getLogsAfter", query="SELECT al FROM AttendanceLog al WHERE al.punchDateTime > :punchDateTime AND al.employeeNo = :employeeNo ORDER BY al.punchDateTime DESC"),
	@NamedQuery(name="AttendanceLog.getLatestLog", query="SELECT al FROM AttendanceLog al WHERE al.employeeNo = :employeeNo ORDER BY al.punchDateTime DESC"),
	@NamedQuery(name="AttendanceLog.getPerviousDayLatestLog", query = "SELECT al FROM AttendanceLog al WHERE al.punchDateTime < :punchDate AND al.employeeNo = :employeeNo ORDER BY al.punchDateTime DESC")
})
public class AttendanceLog implements Serializable {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private long id;
	private Date createdDate;
	private String employeeNo;
	private Date punchDateTime;
	private byte status;
	private String deviceId;
	private String location;
	
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	@Transient
	private String punchDateTimeStr;
	@Transient
	private long userId;
	
	public long getUserId() {
		return userId;
	}
	public void setUserId(long userId) {
		this.userId = userId;
	}
	public String getPunchDateTimeStr() {
		return punchDateTimeStr;
	}
	public void setPunchDateTimeStr(String punchDateTimeStr) {
		this.punchDateTimeStr = punchDateTimeStr;
	}
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getEmployeeNo() {
		return employeeNo;
	}
	public void setEmployeeNo(String employeeId) {
		this.employeeNo = employeeId;
	}
	public Date getPunchDateTime() {
		return punchDateTime;
	}
	public void setPunchDateTime(Date punchDateTime) {
		this.punchDateTime = punchDateTime;
	}
	public byte getStatus() {
		return status;
	}
	public void setStatus(byte status) {
		this.status = status;
	}
	public String getDeviceId() {
		return deviceId;
	}
	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}
	public Date getCreatedDate() {
		return createdDate;
	}
	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
}
